<template>
  <div class="userList">
    <el-table
        :data="items"
        stripe
        style="width: 100%">
      <el-table-column
          prop="id"
          label="ID"
          width="180">
      </el-table-column>
      <el-table-column
          prop="name"
          label="昵称"
          width="180">
      </el-table-column>
      <el-table-column
          prop="mail"
          label="邮箱"
          width="180">
      </el-table-column>
      <el-table-column
          prop="phone"
          width="180"
          label="电话">
      </el-table-column>
      <el-table-column
          prop="avatar"
          label="头像">
        <template slot-scope="scope">
<!--          <p>{{scope.row.avatar}}</p>-->
          <el-avatar fit="fill"   src="https://i2.hdslb.com/bfs/face/92bff8c9e21c6c34c6414bbb9f2e779843dd1e0e.jpg@96w_96h_1c_1s.webp" class="mt10" size="large"></el-avatar>
        </template>

      </el-table-column>

      <el-table-column           width="250"
                                 label="操作">
        <template slot-scope="scope">
          <el-button
              size="mini"
              @click="editUser( scope.row)">编辑</el-button>
          <el-button
              size="mini"
              type="danger"
              @click="banUser( scope.row)">封号</el-button>

          <el-button
              size="mini"
              type="danger"
              @click="deleteUser( scope.row)">删除</el-button>
        </template>
      </el-table-column>


    </el-table>
  </div>
</template>

<script>
import user from "@/api/user";

export default {
  name: "UserList",
  data() {
    return{
      items: [],
      query: {},
    }
  },
  created() {
    this.getData()
  },
  methods:{
    getData() {
     user.getUsers().then(res=>{
       this.items = res.data
     })
    },
    addUser(row){},
    // addUser(row){},
    editUser(row){

    },
    deleteUser(index,row){
      this.items.splice(index,1)
      user.editUser().then(res=>{

      })
    },
    banUser(row){

    },
  }
}
</script>

<style lang="scss" scoped>

.userList{
  width: 95%;
  margin: 0 auto;
}

</style>
